package it.webrules.deploymanager.core.st.scm;

import java.util.Date;

public class SwitchableDir implements Comparable<SwitchableDir> {

	public String name;
	public String url;
	public String commitmessage;
	public Date date;
	public Long revision;
	public Type type;

	public SwitchableDir(String name, String url, String commitmessage, Date date, Long revision, Type type) {
		this.name = name;
		this.url = url;
		this.commitmessage = commitmessage;
		this.date = date;
		this.revision = revision;
		this.type = type;
	}

	@Override
	public String toString() {
		return "SwitchableDir [name=" + name + ", url=" + url + ", commitmessage=" + commitmessage + ", date=" + date + ", revision="
				+ revision + ", type=" + type + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SwitchableDir other = (SwitchableDir) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (type != other.type)
			return false;
		return true;
	}

	@Override
	public int compareTo(SwitchableDir o) {
		return revision.compareTo(o.revision);
	}

}